package tools;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: sun
 * @Description: 将Str格式的Date转换为long,要求dateStr的形式为 yyyy.MM.dd-HH:mm:ss
 * @Data: create in 16:12 2019/1/26
 * @Modfied by:
 */
public class DateStrTanslationUnits {
    private static SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd-HH:mm:ss");
    public static Long dateToLong(String dateStr) throws ParseException {
        Date d = df.parse(dateStr);
        return d.getTime();
    }

    public static double dateToDouble(String dateStr) throws ParseException {
        Date d = df.parse(dateStr);
        return d.getTime();
    }
}

